<?php if (!defined('THINK_PATH')) exit();?>  <style>
    #preview, .img, img  
    {  
        width:150px;  
        //height:150px;  
    }
</style>
<div class="pageContent" style="width:800px;height:600px">	
    <form method="post" action="/tuyouApp/admin/User/edit?callbackType=closeCurrent" enctype="multipart/form-data" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone)">
        <input type='hidden' name='id' value="<?php echo ($userInfo['id']); ?>"/>
        <div class="pageFormContent" layoutH="58">
            <div class="unit">
                <label>昵　称：</label>
                <input type="text" name="nickName" size="30" minlength="1" maxlength="30"  value="<?php echo ($userInfo["nickname"]); ?>" class="required"/>
            </div>
            <div class="unit">
                <label>头　像：</label>
                <div id="preview" style="border-left-width: 27px; margin-left: 126px;"><img src="<?php echo (PUBLIC_URL); echo ($userInfo["big_photo"]); ?>" style="padding-left: 0px;"/></div>
                <input type="file" id="file"  name="icon" value="" onchange="preview(this)" style="margin-left: 124px;"/><br/>
            </div>
            <div class="unit">
                <label>性　别：</label>
                <label><input type="radio" name="sex" value="1" checked/>男</label>
                <label><input type="radio" name="sex" value='2'/>女</label> 
            </div>
            <div class="unit">
                <label>用户类型：</label>
                <select class="" name="type" style="width: 101px;">
                    <option value='0' selected="selected">普通用户</option>
                    <option value="1" >企业用户</option>
                    <option value="2" >管理员</option>
                    <?php if(($_SESSION['type']) == "3"): ?><option value="3" >开发人员</option><?php endif; ?>
                </select>
            </div>
            <eq name="userInfo['id']">
                <div class="unit">
                    <label>密　码：</label>
                    <input type="password" id="cp_newPassword" name="password" size="30" minlength="6" maxlength="20" class="required alphanumeric"/>
                </div>            
                <div class="unit">
                    <label>确认密码：</label>
                    <input type="password" name="rnewPassword" size="30" equalTo="#cp_newPassword" class="required alphanumeric"/>
                </div>
            <neq>
            <div class="unit">
                <label>公司名称：</label>
                <input type="text" name="companyName" size="30"  value="<?php echo ($userInfo["companyname"]); ?>"/>
            </div>
             <div class="unit">
                <label>联系电话：</label>
                <input type="text" name="tel" size="30" class="alphanumeric" value="<?php echo ($userInfo["tel"]); ?>"/>
            </div>
            <div class="unit">
                <label>地区：</label>
                <select class="" name="regionId" style="width: 101px;">                   
                    <?php if(is_array($region)): foreach($region as $key=>$region): ?><option value="<?php echo ($region["id"]); ?>" <?php if($region['id'] == $userInfo['regionid']): ?>selected<?php endif; ?>><?php echo ($region["name"]); ?></option><?php endforeach; endif; ?>
                </select>
            </div>
            <div class="unit">
                <label>积分：</label>
                <input type="text" name="integral" size="30"  class="alphanumeric" value="<?php echo ($userInfo["integral"]); ?>"/>
            </div>
            <div class="unit">
                <div class="unit">
                    <label><input type="radio" name="state" value="1" <?php if($userInfo['state'] == 1): ?>checked<?php endif; ?>/>待审核</label>
                    <label><input type="radio" name="state" value='2' <?php if(($userInfo['state'] == 2) or ($userInfo['use_level'] == '')): ?>checked<?php endif; ?>/>正常</label>
                    <label><input type="radio" name="state" value='3' <?php if($userInfo['state'] == 3): ?>checked<?php endif; ?>/>禁用</label>                
                </div>
            </div>
        </div>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive"><div class="buttonContent"><button type="submit">提交</button></div></div></li>
                <li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
            </ul>
        </div>
    </form>	
</div>
<script>
    //头像预览
        function preview(file)  
        {  
            var prevDiv = document.getElementById('preview');  
            if (file.files && file.files[0])  
            {  
            var reader = new FileReader();  
            reader.onload = function(evt){  
            prevDiv.innerHTML = '<img src="' + evt.target.result + '" />';  
           }    
            reader.readAsDataURL(file.files[0]);  
           }  
            else    
            {  
            prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';  
            }  
        }  
</script>